clear all
set more off
est clear

* set stata version 
version 15

* seeds for reproducibility
set seed 4353443
set sortseed 3534547

*project root directory 
global dir = "C:\Users\...\JDE - Replication package"

*strucutre within this directory 
global data "${dir}\Data"
global code "${dir}\Do"
global tables "${dir}\Tables"
global figures "${dir}\Figures"


*** Required programs
local programs = "labutil estout ietoolkit distinct tabout winsor"
local install = 0
if (`install'==1) { 
  foreach p in `programs' {
    ssc install `p'
  }
} 

*** Command to export the latex tables
run "${code}/Programs/texsave_custom.do"


*** Prep the raw data 
do "${code}\1.DataPrep.do"  

*** Run the analysis 
* Balance: Table 3
do "${code}\2.Balance.do" 
* Attrition: Table 4 and Table A1
do "${code}\3.Attrition.do"
* Compliance: Table 5 
do "${code}\4.Compliance.do"
* Mental Health results: Tables 6 and 7 and Appendix Table A3 and A4 
do "${code}\5.1.MentalHealth-Paper.do"
do "${code}\5.2.MentalHealth-Appendix.do"
* Mental health LATE estimates: Figure 2 and Appendix Tables A2 and A5
do "${code}\6.MentalHealth-LATE.do"
* Mental health, impacts on Major Depression: Appendix Table A6
do "${code}\7.MentalHealth-MDD.do"
* Mental health score densities: Figure 3
do "${code}\8.MentalHealth-Densities.do"
* Human capital accumulation results: Tables 8, 9, and 10, and Appendix Tables A7, A8, and A9
do "${code}\9.1.HumanCapital-Paper.do"
do "${code}\9.2.HumanCapital-Appendix.do"
* Impact of cash and covid-19: Table 11 
do "${code}\10.Covid19.do"
* Robustness of cash impacts to attrition: Appendix Table A10 and A11
do "${code}\11.AttritionBounds.do"

